package com.flash.javamate;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

/**
 * Created by sunyiming on 2018/7/5.
 * Description:
 */
public class TimeClient {

    public static void main(String[] args) throws IOException, InterruptedException {
        int port = 139;
        Socket socket = null;
        BufferedReader in = null;
        PrintWriter out = null;
        try {
            socket = new Socket("10.3.23.234", port);
            in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            out = new PrintWriter(socket.getOutputStream(), true);
            while (true) {
                out.println("time");
                System.out.println("send order 2 server succeed");
                String resp = in.readLine();
                System.out.println("Time: "+ resp);
                Thread.sleep(1000L);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            socket.close();
            socket = null;
        }
    }

}
